package com.woniuxy.api;

import com.woniuxy.entity.Product;
import com.woniuxy.entity.ProductDTO;
import com.woniuxy.entity.utils.ResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 邓宇昂
 * @Description: 使用OpenFeign对远程product服务进行调用，接口
 * @DateTime: 22/12/07/0007 10:42
 * @Component: 成都蜗牛学苑
 *
 **/
//restTemplate.put("http://myh-product/product/"+pid,ResponseEntity.class,product);
@FeignClient(value = "myh-product")
@RequestMapping("/product")
public interface RemoteProductServe {
    @GetMapping("/{pid}")
    ResponseEntity findOneByPid(@PathVariable("pid") Integer pid);
    @PutMapping("/")
    ResponseEntity updateProduct(@RequestBody Product product);
    //    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice(@RequestParam("name") String name,@RequestParam("minPrice") double minPrice,
//                                               @RequestParam("maxPrice") double maxPrice);
//    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice1(@SpringQueryMap Map map);
    @GetMapping("/findCondition")
    public ResponseEntity findAllByNameOrPrice(@SpringQueryMap ProductDTO productDTO);
}